Part 1. Notebook for Network Analysis in Neuroscience

Authors: Eduarda Centeno & Fernando Santos

With notebook we would like to facilitate the computation of different metrics in network analysis in the field of Neuroscience. Our goal is to cover both standard Graph Theory metrics, and some Topological & Geometric Data Analysis metrics.

In here, we will not include any step regarding preprocessing of image data, but we assume that the connectivity matrix is already available. The matrices used here as examples are solely fMRI data (i.e., based in correlation values of time series) obtained from the Human Connectome Project. However, the scripst used here can be easily adapted to networks based in other imaging modalities.

Table of contents

  1. Imports
  2. Importing data & the connectivity matrix
  3. Graph Theory
  4. Topology & Geometry

1. Imports

Let's start with the necessary packages for the following computations:

2. Importing data & the connectivity matrix

Now we will start working with the brain data.

Here, we will try to cover both computation and some theoretical backgroud/key points on each section.

Our first step will be on how to import the matrix data:
#
Here I'll make available the computation on how to compute the avarege matrix, but to make it faster, we'll work with the file that we already saved.

The idea here is to get an average matrix from all matrices available. For that, different methods can be used. We'll show two common ones: one with pandas, another with Numpy.

#

Now, let's use Seabon Heatmap to plot correlation matrix:

After importing the matrix that we want to work with, we can start with a stardad representation - heatmaps!

Here is our Heatmap!
Key point:

When working with network analysis in brain data, a couple of key decisions have to be made in order to define how the metrics will be computed and how to best preseve information. For example, one can decide to use all connections in the network - including ones with low values (sometimes considered as spurious connetions), or it is possible to establish an arbitraty threshold of which connections will be kept (e.g. only connections above a correlation value of 0.8). This step can be done in different ways, based solely on the correlation threshold (as done here), but it can also be done based on network density (i.e. you keep only the 20% strongest correlations). If using an arbitraty threshold, it is also possible to define if the resulting matrix will be weighted (i.e. the value of each connection will be kept), or unweighted (binarized matrices).

Another point of discussion is how to deal with negative weights in weighted networks. Several metrics from graph theory are not adapted for negative weights, therefore a common practice is to absolutize the matrix, therefore preserving the topology but sending all weights to positive values. Here, we have chosen to proceed by using all connections in the correlation matrix, and absolutize them so that all metrics can be computed.

We strongly suggest the readers to read Reference [1] for a deeper understanding on all these decisions.

A summary of the types of networks can be found below:

matrices.jpg

Figure 1. Types of networks. A) A binary directed graph. B) Binary, undirected graph. C) A representation of the graph F in the context of brain areas. D) A weighted, directed graph. F) A weighted, undirected graph. G) A connectivity matrix of C and F. Source: Part of the image was obtained from Smart Servier Medical Art.

Key point:

When working with network data, there are some interesting basic computations that can tell us basic properties about it. When working with undirected weighted matrices, for example, the distribution of strenght values can tell us about how many weak correlations we might have. In general, in fMRI correlation data we expect most to be weak correlations and a few strong ones. When plotted as a probability density of log10, we expect it to be close to a Gaussian distribution!

3. Graph Theory

From now, we will start working with some common Graph Theory metrics.

The metrics that we will cover here are:

Key point:

Each of these metrics have their own requisites for computation. For example, metrics such as closeness centrality and average shortest path cannot be computed accurately for fragmented networks (i.e. there are subsets of disconnected nodes). Therefore, when thinking about establishing arbitrary thresholds for the matrix, this must be taken into account.

A summary of some metrics can be found in the figure below:

GT.jpg Figure 2. Graph theoretical metrics. A) A representation of a graph indicating centralities. B) Two modules connected to each other via a connector hub. A provincial hub can be identified in grey (which in this case also has the highest clustering coefficient). C) The shortest path between nodes A and B. D) The minimum spanning tree.

We will start by creating the graph and removing its self-loops (i.e. a connection of a node with itself).
Now, we compute the density of the network - another key basic information that is usually obtained for graphs.

Definition: The density of a graph is the ratio between the number of edges and the total number of possible edges.

Clearly, in all-to-all connected graphs, the density will be maximal (1), whereas for a graph withouth edges it will be 0. Here, just for the sake of demonstration, we will compute the density of different states of the network to show how density changes.

Now, we compute the degree/strength of the nodes.

Definition: In undirected weighted networks the node strength can be computed as the sum of the connectivity weights of the edges attached to each node. It is a basic metric to identify how important is a node in the graph. To make this value more intuitive, it is possible to normalize it by diving the sum of the weights by 1/N-1. (Ref [1] pg. 119)

In degree computation, it is also common to compute the mean degree of the network, which is the sum of node degrees divides by the total number of nodes.

Next, we will compute the centralities!

Centralities are frequently used to understand which nodes occupy critical positions in the network.

Remember:

Now, let's move on to the Path Length!
Now, modularity, assortativity, clustering coefficient and the minimum spanning tree!

Data Visualization & Graph Theory

Under this section we we'll provide a few ideas of how to visualize and present your network.

First, let's get some important attributes about brain area names and subnetworks. These will be used later for graphical visualization!

Now we will create a standard spring network plot, but this could also be made circular by changing to draw_circular.

We defined the edge widths to the power of 2 so that weak weights will have smaller widths.

4. Topology & Geometry

Moving on to Topology & Geometry metrics.

Here, we will cover a few computations that are being applied in Neuroscience:

Let's start with persistent homology computations:

Persistent homology is a method for computing topological features of a space at different spatial resolutions. With it we can track homology cycles across simplicial complexes, and determine whether there were homology classes that “persisted” for a long time (Ref [2]). The basic idea is summarized in the illustration below.

TDA2.jpg A) Types of simplices and cliques. B) Evolution of shapes across filtration. C) Persistence Barcode D) What it would represent in how the brain is connected. E) Birth-Death graphs from C. Phase-transitions can be identified in this plot.

Computation of phase transitions and curvature

One way of connecting geometry of a continuous surface to its topology is by using the concept of local curvature and Euler characteristic. Here, we will compute the network curvature at each node to calculate tolopogical phase transitions in brain networks from a local perspective (Ref [3])

Now, we can obtain the value of curvature for each node at a specific threshold, and then save as a dict with the region name abbreviations.
References

[1] Fornito A, Zalesky A, Bullmore E (2016) Fundamentals of brain network analysis: Academic Press.

[2] Bassett DS, Sporns O (2017) Network neuroscience. Nature neuroscience 20:353.

[3] Santos FAN, Raposo EP, Coutinho-Filho MD, Copelli M, Stam CJ, Douw L (2019) Topological phase transitions in functional brain networks. Phys Rev E 100:032414.

Acknowledgements

"Data were provided [in part] by the Human Connectome Project, MGH-USC Consortium (Principal Investigators: Bruce R. Rosen, Arthur W. Toga and Van Wedeen; U01MH093765) funded by the NIH Blueprint Initiative for Neuroscience Research grant; the National Institutes of Health grant P41EB015896; and the Instrumentation Grants S10RR023043, 1S10RR023401, 1S10RR019307."